<template>
   <div class="title">
      <van-nav-bar fixed placeholder left-text="返回" left-arrow @click-left="onClickLeft">
         <template #title>
            <slot></slot>
         </template>
         <template #right>
            <slot name='right'></slot>
         </template>
      </van-nav-bar>
   </div>
</template>
<script lang='ts' setup>
const onClickLeft = () => {
   const token = localStorage.getItem('token');
   const userid = localStorage.getItem('userid');
   if (token && userid) {
      history.back();
   } else {
      location.href = '/';
   }
} 
</script>
<style lang="less" scoped>
:deep(.van-nav-bar) {
   z-index: 1000;
}
</style>